/**
 * Created by 준영 on 14. 3. 25.
 */

var IndexViewModel = (function(){

  function IndexViewModel()
  {

  };
  Function.prototype.method = function(name, func)
  {
    this.prototype[name] = func;
  };

  IndexViewModel.method("setUrls", function(isMobile)
  {
    if(isMobile)
    {
        this.naverUrl = "http://m.cafe.naver.com/dungeon7";
    }
    else
    {
      this.naverUrl = "http://cafe.naver.com/dungeon7";
    }
  });

  return IndexViewModel;
})();

$(function() {
  $( "#tabs" ).tabs({
    activate:function(event,ui){
      var sel = (ui.oldTab)[0];
      var newSel = (ui.newTab)[0];

      $(sel).removeClass('active');

      $(newSel).addClass('active');

      $('#currentState').text(newSel.textContent);

    }
  });
});

function autoResize(id){
    var newheight;
    var newwidth;

    if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
        newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
    }

    document.getElementById(id).height= (newheight) + "px";
    document.getElementById(id).width= (newwidth) + "px";
};

$(document).ready(function(){

  var viewModel = new IndexViewModel();
  viewModel.setUrls(isMobile);

  ko.applyBindings(viewModel);
});